﻿' ----------------------------------------------------------------------------------
' Microsoft Developer & Platform Evangelism
' 
' Copyright (c) Microsoft Corporation. All rights reserved.
' 
' THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
' OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ----------------------------------------------------------------------------------
' The example companies, organizations, products, domain names,
' e-mail addresses, logos, people, places, and events depicted
' herein are fictitious.  No association with any real company,
' organization, product, domain name, email address, logo, person,
' places, or events is intended or should be inferred.
' ----------------------------------------------------------------------------------

Imports System.Data.Entity
Imports Microsoft.Samples.WindowsPhoneCloud.Web.Models

Namespace Infrastructure

    ' Summary:
    '     Sample Entity Framework 4.1 data initializer for SQL Azure.
    '     The seed method is executed after the database is created using EF 4.1 Code-First, 
    '     giving the developer the opportunity to insert "seed" (i.e. initial) data.
    '     For more information, visit the ADO.NET Entity Framework website at http://msdn.microsoft.com/data/aa937723
    Public Class SqlSampleDataInitializer
        Inherits DropCreateDatabaseIfModelChanges(Of SqlSampleDataContext)
        Protected Overrides Sub Seed(ByVal context As SqlSampleDataContext)
            Dim data = New List(Of SqlSampleData) From {
             New SqlSampleData With {.Id = 1, .Title = "I am the first title", .IsPublic = True, .Date = DateTime.UtcNow},
             New SqlSampleData With {.Id = 2, .Title = "I am the second title", .IsPublic = True, .Date = DateTime.UtcNow}}

            data.ForEach(Function(d) context.SqlSampleData.Add(d))
        End Sub
    End Class
End Namespace